//
//  LoginViewController.m
//  TextApplication
//
//  Created by dllo on 16/8/27.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "LoginViewController.h"
#import "TAMacro.h"
#import "RegViewController.h"
#import "LogViewController.h"

@interface LoginViewController ()

@property (nonatomic, strong) UIImageView *backImageView;
@property (nonatomic, strong) UIView *backView;
@property (nonatomic, strong) UIButton *regButton;
@property (nonatomic, strong) UIButton *loginButton;
@property (nonatomic, strong) UIButton *backButton;

@end

@implementation LoginViewController

- (void)viewWillAppear:(BOOL)animated {
    self.navigationController.navigationBar.hidden = YES;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    self.backImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    self.backImageView.image = [UIImage imageNamed:@"5"];
    [self.view addSubview:self.backImageView];
    
    self.backView = [[UIView alloc] initWithFrame:CGRectMake(0, HEIGHT / 5 * 4, WIDTH, HEIGHT / 5 * 2)];
    self.backView.backgroundColor = [UIColor blackColor];
    self.backView.alpha = 0.7;
    [self.view addSubview:self.backView];
    
   
    
    self.regButton = [UIButton buttonWithType:UIButtonTypeSystem];
    self.regButton.backgroundColor = [UIColor whiteColor];
    self.regButton.frame = CGRectMake(20, 15, WIDTH - 40, 45);
    [self.regButton setTitle:@"注册良仓" forState:UIControlStateNormal];
    [self.regButton addTarget:self action:@selector(regClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.regButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.backView addSubview:self.regButton];
    
    self.loginButton = [UIButton buttonWithType:UIButtonTypeSystem];
    self.loginButton.backgroundColor = [UIColor whiteColor];
    self.loginButton.frame = CGRectMake(20, 75, WIDTH - 40, 45);
    [self.loginButton setTitle:@"登录" forState:UIControlStateNormal];
    [self.loginButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.loginButton addTarget:self action:@selector(logClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.backView addSubview:self.loginButton];
    
    self.backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.backButton.frame = CGRectMake(WIDTH - 40, 35, 20, 20);
    [self.backButton setImage:[UIImage imageNamed:@"6"] forState:UIControlStateNormal];
    [self.view addSubview:self.backButton];
    [self.backButton addTarget:self action:@selector(backClick:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)backClick:(UIButton *)button {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)regClick:(UIButton *)button {
    RegViewController *vc = [[RegViewController alloc] init];
    [self presentViewController:vc animated:YES completion:nil];
}

- (void)logClick:(UIButton *)button {
    LogViewController *logVC = [[LogViewController alloc] init];
    [self presentViewController:logVC animated:YES completion:nil];
}
- (void)viewDidDisappear:(BOOL)animated {
    self.navigationController.navigationBar.hidden = NO;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
